package org.smr.dev.web;

import org.smr.dev.model.TableInfo;
import org.smr.dev.service.TableInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("table")
public class TableMeteController {


    @Autowired
    private TableInfoService tableInfoService;

    @RequestMapping("test")
    public String index(){

        List<TableInfo> tableInfoList = tableInfoService.findTable();
       // System.out.println(JSONUtils.toJSONString(tableInfoList));
        return "/index";
    }

    @RequestMapping("index")
    public String tableIndex(Model model){

        List<TableInfo> tableInfoList = tableInfoService.findTable();
        model.addAttribute("hello","张三");
        model.addAttribute("list",tableInfoList);
        return "/table/table-index";
    }

}
